<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
    <title>Bet on chope, sell your friend!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Content-Language" content="fr" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/viewMarket.css" />
   <!-- includes lib -->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript" src="{{ STATIC_URL}}javascript/jquery-1.2.6.min.js"></script>
    <!--graphs and charts-->
	<script type="text/javascript" src="{{ STATIC_URL}}javascript/repartitionchart.js"></script>
    <script type="text/javascript" src="{{ STATIC_URL}}javascript/repartitionMarketChart.js"></script>
	<script type="text/javascript" src="{{ STATIC_URL}}javascript/mtmrepartitionchart.js"></script>
	<script type="text/javascript" src="{{ STATIC_URL}}javascript/mtmschart.js"></script>
	<script type="text/javascript" src="{{ STATIC_URL}}javascript/priceschart.js"></script>
	<script type="text/javascript" src="{{ STATIC_URL}}javascript/rankingtable.js"></script>
    <script type="text/javascript" src="{{ STATIC_URL}}javascript/markettable.js"></script>
    <script type="text/javascript" src="{{ STATIC_URL}}javascript/playerTable.js"></script>
</head>

<body>

    {% load argTemplates %}
    {% load binaryOPerationTemplateTag %}

    
    <div id="globalContainer">
		<div id="introduction">
                <div id="playerName">
                    Logged as - {{player.getName}}
                </div>
                <div id="logout">
                    <a href="/logoutView/">logout</a> 
                </div>
                <br></br>
                <div id="rules">
                    <a href="http://code.google.com/p/celibax/source/browse/trunk/market/Rules.txt"> Need help? </a> 
                </div> 
		</div><!--introduction-->
		
       
      <div id="summaryContainer">
        <h3 align="left">My fund</h3>
        <div id="strategySummary">
            <div id="playerSummary">
            {% with temp=player.getMainFundTotalNumberOfAssets %}
            total number of assets: {{ temp|toStringWithDigits:"2"  }}
         	{% endwith %}
	        </div>
	        <div id="playerCash">

		        current value of my fund: 
    	        {% with temp=market|args:player.getViewMainFund|call:"getStrategyMtM" %}
        	        {% with temp2=player.getMainFundTotalNumberOfAssets|multWithScalar:temp %}
            	        {{ temp2|toStringWithDigits:"2"  }}
         	        {% endwith %}
    	        {% endwith %}
		        chochoros
	        </div>
        </div><!--end strategySummary-->
		<div id="playerTable_div"></div>
      </div> <!--summaryContainer-->  
   
    <div id="chartcontainer">
        <h3 align="left">Current Market</h3>		    
        <div id="repChat">
            <div id="repartitionMarketChart_div"></div>
            <div id="marketTable_div"></div>   
        </div>
    </div>

     
       <div id="strategyDetails">
            <h3 align="left">Time for Action!</h3>

			<!--
            <div id="strayegyTableDetails">
                <h4 align="left">Detail</h4>
                <table border="1">
                
                    <tr>
                        <th >Asset</th>
                        {% for asset in market.assets %}
                        <th width="70">
                            {{asset.name}}
                        </th>
                        {% endfor %}
                        <th style="padding-left:20px"></th>
                        <th>Total</th>
                    </tr>
                    <tr>
                        <th>
                            Ma vue
                        </th>
                        {% for asset in market.assets %}
                        <td width="70" align="center">
                        {% with tmp=player.getViewMainFund|args:asset|call:"getViewOnAsset" %}
                            {{ tmp|toStringWithDigits:"2" }}
                        {% endwith %}
                        </td>
                        {% endfor %}
                        <th style="padding-left:20px"></th>
                        <th>100</th>
                    </tr>
                    <tr>
                        <th>
                            Prix
                        </th>
                        {% for asset in market.assets %}
                        <td width="70" align="center">
                            {% with tmp=market.getMarketView|args:asset|call:"getViewOnAsset" %}
                                {{ tmp|toStringWithDigits:"2" }}
                            {% endwith %}
                        </td>
                        {% endfor %}
                        <th style="padding-left:20px"></th>
                        <th>100</th>
                    </tr>
                    <tr>
                        <th>
                            Quantit&eacute;
                        </th>
                        {% for asset in market.assets %}
                        <td width="70" align="center">
                            {% with temp=player|args:asset|call:"getNumberOfSpecifiedAssetInMainFund" %}
                                {{ temp|toStringWithDigits:"2" }}
                            {% endwith %}
                        </td>
                        {% endfor %}
                        <th style="padding-left:20px"></th>
                        <th> {{ player.getMainFundTotalNumberOfAssets|toStringWithDigits:"2" }} </th>
                    </tr>
                    <tr>
                        <th>
                            Valeur
                        </th>
                        {% for asset in market.assets %}
                        <td width="70" align="center">
                            {% with temp1=player|args:asset|call:"getNumberOfSpecifiedAssetInMainFund" %}
                                {% with temp2=market.getMarketView|args:asset|call:"getViewOnAsset" %}
                                    {% with temp3=temp1|multWithScalar:temp2 %}
                                        {{ temp3|toStringWithDigits:"2" }}
                                    {% endwith %}
                                {% endwith %}
                            {% endwith %}
                        </td>
                        {% endfor %}
                        <th style="padding-left:20px"></th>
                        {% with temp=market|args:player.getViewMainFund|call:"getStrategyMtM" %}
                            <th>
                            {% with temp2=player.getMainFundTotalNumberOfAssets|multWithScalar:temp %}
                                {{ temp2|toStringWithDigits:"2"  }}
                            {% endwith %}
                            </th>
                        {% endwith %}
                    </tr>
                
                </table>
            </div> -->
            
            <div id="strategyChange">
                <h4 align="left">Change my strategy</h4>
                <div id="sellAsset">
                    
                    <form action="/sellAsset/" method="post">
                    {% csrf_token %}
                    <h5 align="left"> Selling an asset against the equivalent amount of an other</h5>
                    <p>
                        I want to exchange (sell)
                        <td align="center">
                            <input name="numberSold" id="id_numberSold" align="middle" type="text" size="5%" value="0">
                            </input>
                        </td>
                        <select name="soldAsset" id="id_soldAsset">
                            {% for asset in market.assets %}
                            <option>
                            {{asset.name}} {% endfor %}
                        </select>
                        to get
                        <select name="boughtAsset" id="id_boughtAsset">
                            {% for asset in market.assets %}
                            <option>
                            {{asset.name}} {% endfor %}
                        </select>
                        <input type="submit" value="bam done deal!" />
                    </p>
                    </form>
                </div> <!--<div id="sellAsset">-->

            
                <div id="newRepartition">
                    <form action="/SubmitNewRepartition/" method="post">
                    {% csrf_token %}
                    <table border="1">
                        <h5 align="left">I want a totally new repartition</h5>
                        <tr>
                            {% for asset in market.assets %}
                            <th width="70">
                                {{asset.name}}
                            </th>
                            {% endfor %}
                        </tr>
                        <tr>
                            {% for asset in market.assets %}
                            <td>
                            {% with tmp=player.getViewMainFund|args:asset|call:"getViewOnAsset" %}
                                <input name="{{asset.name}}" type="text" size="5%" value={{ tmp|toStringWithDigits:"2" }} >
                            {% endwith %}
                            </td>
                            {% endfor %}
                        </tr>
                    </table>
                    <input type="submit" value="Post my view and do the calculation for me" />
                    </form>
                </div> <!--<div id="newRepartition">-->
            
         </div> <!--end strategyChange-->   

        </div ><!--<div id="strategyDetails">-->
  
    <div id="history">
        <h3 align="left">History</h3>
        <div id="priceschart_div"></div>
        <div id="mtmschart_div"></div>
        <div id="rankingtable_div"></div>
    </div>
 	</div>       

</body>
</html>
